package com.jackrain.nea.oms.dao;

import com.alibaba.fastjson.JSONObject;
import com.jackrain.nea.oms.model.*;
import com.jackrain.nea.web.query.QueryEngine;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.sql.Timestamp;

/**
 * datav
 * @author xyc
 */
@Slf4j
@Component
public class DatavAoKangDao {
    /**
     * 插入YsnO2oSoStat1表
     * @param ysnO2oSoStat1Model
     **/
    public int YsnO2oSoStat1Insert(YsnO2oSoStat1Model ysnO2oSoStat1Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_stat1" +
                "(s_tot_amt_actual,s_qty,d_tot_amt_actual," +
                "c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?,?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStat1Model.getS_tot_amt_actual(), ysnO2oSoStat1Model.getS_qty(), ysnO2oSoStat1Model.getD_tot_amt_actual(), ysnO2oSoStat1Model.getC_id(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStat1
     * */
    public void recYsnO2oSoStat1(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStat1Model ysnO2oSoStat1Model = new YsnO2oSoStat1Model();
            ysnO2oSoStat1Model.setS_tot_amt_actual(objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL"));
            ysnO2oSoStat1Model.setS_qty(objectdetail.getInteger("S_QTY") == null? 0 : objectdetail.getInteger("S_QTY"));
            ysnO2oSoStat1Model.setD_tot_amt_actual(objectdetail.getDouble("D_TOT_AMT_ACTUAL") == null? 0 : objectdetail.getDoubleValue("D_TOT_AMT_ACTUAL"));
            ysnO2oSoStat1Model.setC_id(objectdetail.getInteger("C_ID"));
            YsnO2oSoStat1Insert(ysnO2oSoStat1Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnO2oSoStat2表
     * @param ysnO2oSoStat2Model
     * */
    public int YsnO2oSoStat2Insert(YsnO2oSoStat2Model ysnO2oSoStat2Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_stat2" +
                "(c_prov_name,c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStat2Model.getC_prov_name(), ysnO2oSoStat2Model.getC_id(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStat2
     * */
    public void recYsnO2oSoStat2(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStat2Model ysnO2oSoStat2Model = new YsnO2oSoStat2Model();
            ysnO2oSoStat2Model.setC_prov_name(objectdetail.getString("C_PROV_NAME"));
            ysnO2oSoStat2Model.setC_id(objectdetail.getInteger("C_ID"));
            YsnO2oSoStat2Insert(ysnO2oSoStat2Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnO2oSoStatic3表
     * @param ysnO2oSoStatic3Model
     * */
    public int YsnO2oSoStatic3Insert(YsnO2oSoStatic3Model ysnO2oSoStatic3Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_static3" +
                "(s_tot_amt_actual,c_block," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStatic3Model.getS_tot_amt_actual(), ysnO2oSoStatic3Model.getC_block(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStatic3
     * */
    public void recYsnO2oSoStatic3(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStatic3Model ysnO2oSoStatic3Model = new YsnO2oSoStatic3Model();
            ysnO2oSoStatic3Model.setS_tot_amt_actual(objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL"));
            ysnO2oSoStatic3Model.setC_block(objectdetail.getString("C_BLOCK"));
            YsnO2oSoStatic3Insert(ysnO2oSoStatic3Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnO2oSoStatic4表
     * @param ysnO2oSoStatic4Model
     * */
    public int YsnO2oSoStatic4Insert(YsnO2oSoStatic4Model ysnO2oSoStatic4Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_static4" +
                "(s_tot_amt_actual,store," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStatic4Model.getS_tot_amt_actual(), ysnO2oSoStatic4Model.getStore(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStatic4
     * */
    public void recYsnO2oSoStatic4(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStatic4Model ysnO2oSoStatic4Model = new YsnO2oSoStatic4Model();
            ysnO2oSoStatic4Model.setS_tot_amt_actual(objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL"));
            ysnO2oSoStatic4Model.setStore(objectdetail.getString("STORE"));
            YsnO2oSoStatic4Insert(ysnO2oSoStatic4Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnO2oSoStat5表
     * @param ysnO2oSoStat5Model
     * */
    public int YsnO2oSoStat5Insert(YsnO2oSoStat5Model ysnO2oSoStat5Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_stat5" +
                "(tot_amt_actual,c_city_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStat5Model.getTot_amt_actual(), ysnO2oSoStat5Model.getC_city_id(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStat5
     * */
    public void recYsnO2oSoStat5(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStat5Model ysnO2oSoStat5Model = new YsnO2oSoStat5Model();
            ysnO2oSoStat5Model.setTot_amt_actual(objectdetail.getBigDecimal("TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("TOT_AMT_ACTUAL"));
            ysnO2oSoStat5Model.setC_city_id(objectdetail.getString("C_CITY_ID"));
            YsnO2oSoStat5Insert(ysnO2oSoStat5Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnO2oSoStatic6表
     * @param ysnO2oSoStatic6Model
     * */
    public int YsnO2oSoStatic6Insert(YsnO2oSoStatic6Model ysnO2oSoStatic6Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_static6" +
                "(vaules,s_qty," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStatic6Model.getVaules(), ysnO2oSoStatic6Model.getS_qty(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStatic6
     * */
    public void recYsnO2oSoStatic6(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStatic6Model ysnO2oSoStatic6Model = new YsnO2oSoStatic6Model();
            ysnO2oSoStatic6Model.setVaules(objectdetail.getString("VAULES"));
            ysnO2oSoStatic6Model.setS_qty(objectdetail.getInteger("S_QTY") == null? 0 : objectdetail.getInteger("S_QTY"));
            YsnO2oSoStatic6Insert(ysnO2oSoStatic6Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnO2oSoStatic7表
     * @param ysnO2OSoStat7Model
     * */
    public int YsnO2oSoStatic7Insert(YsnO2oSoStat7Model ysnO2OSoStat7Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_stat7" +
                "(c_city_id,c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2OSoStat7Model.getC_city_id(), ysnO2OSoStat7Model.getC_id(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStatic7
     * */
    public void recYsnO2oSoStatic7(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStat7Model ysnO2OSoStat7Model = new YsnO2oSoStat7Model();
            ysnO2OSoStat7Model.setC_city_id(objectdetail.getString("C_CITY_ID"));
            ysnO2OSoStat7Model.setC_id(objectdetail.getString("C_ID"));
            YsnO2oSoStatic7Insert(ysnO2OSoStat7Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnO2oSoStat10表
     * @param ysnO2oSoStat10Model
     * */
    public int YsnO2oSoStat10Insert(YsnO2oSoStat10Model ysnO2oSoStat10Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_stat10" +
                "(vaules,s_qty," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStat10Model.getVaules(), ysnO2oSoStat10Model.getS_qty(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStat10
     * */
    public void recYsnO2oSoStat10(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStat10Model ysnO2oSoStat10Model = new YsnO2oSoStat10Model();
            ysnO2oSoStat10Model.setVaules(objectdetail.getString("VAULES"));
            ysnO2oSoStat10Model.setS_qty(objectdetail.getInteger("S_QTY") == null? 0 : objectdetail.getInteger("S_QTY"));
            YsnO2oSoStat10Insert(ysnO2oSoStat10Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnO2oSoStat11表
     * @param ysnO2oSoStat11Model
     * */
    public int YsnO2oSoStat11Insert(YsnO2oSoStat11Model ysnO2oSoStat11Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_stat11" +
                "(vaules,s_qty," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoStat11Model.getVaules(), ysnO2oSoStat11Model.getS_qty(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoStat11
     * */
    public void recYsnO2oSoStat11(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoStat11Model ysnO2oSoStat11Model = new YsnO2oSoStat11Model();
            ysnO2oSoStat11Model.setVaules(objectdetail.getString("VAULES"));
            ysnO2oSoStat11Model.setS_qty(objectdetail.getInteger("S_QTY") == null? 0 : objectdetail.getInteger("S_QTY"));
            YsnO2oSoStat11Insert(ysnO2oSoStat11Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnO2oSoItemStat12表
     * @param ysnO2oSoItemStat12Model
     * */
    public int YsnO2oSoItemStat12Insert(YsnO2oSoItemStat12Model ysnO2oSoItemStat12Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_soitem_stat12" +
                "(m_dim2_id,s_qty," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoItemStat12Model.getM_dim2_id(), ysnO2oSoItemStat12Model.getS_qty(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoItemStat12
     * */
    public void recYsnO2oSoItemStat12(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoItemStat12Model ysnO2oSoItemStat12Model = new YsnO2oSoItemStat12Model();
            ysnO2oSoItemStat12Model.setM_dim2_id(objectdetail.getString("M_DIM2_ID"));
            ysnO2oSoItemStat12Model.setS_qty(objectdetail.getInteger("S_QTY") == null? 0 : objectdetail.getInteger("S_QTY"));
            YsnO2oSoItemStat12Insert(ysnO2oSoItemStat12Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnO2oSoItemStat13表
     * @param ysnO2oSoItemStat13Model
     * */
    public int YsnO2oSoItemStat13Insert(YsnO2oSoItemStat13Model ysnO2oSoItemStat13Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_soitem_stat13" +
                "(m_dim2_id,s_qty," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoItemStat13Model.getM_dim2_id(), ysnO2oSoItemStat13Model.getS_qty(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoItemStat13
     * */
    public void recYsnO2oSoItemStat13(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoItemStat13Model ysnO2oSoItemStat13Model = new YsnO2oSoItemStat13Model();
            ysnO2oSoItemStat13Model.setM_dim2_id(objectdetail.getString("M_DIM2_ID"));
            ysnO2oSoItemStat13Model.setS_qty(objectdetail.getInteger("S_QTY") == null? 0 : objectdetail.getInteger("S_QTY"));
            YsnO2oSoItemStat13Insert(ysnO2oSoItemStat13Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnCus表
     * @param ysnCusModel
     * */
    public int YsnCusInsert(YsnCusModel ysnCusModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_cus" +
                "(c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnCusModel.getC_id(),
                timec, time, "Y"});
    }

    /**
     * YsnCus
     * */
    public void recYsnCus(JSONObject objectdetail, Timestamp time){
        try {
            YsnCusModel ysnCusModel = new YsnCusModel();
            ysnCusModel.setC_id(objectdetail.getInteger("C_ID"));
            YsnCusInsert(ysnCusModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnNoOut表
     * @param ysnNoOutModel
     * */
    public int YsnNoOutInsert( YsnNoOutModel ysnNoOutModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_noout" +
                "(c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnNoOutModel.getC_id(),
                timec, time, "Y"});
    }

    /**
     * YsnNoOut
     * */
    public void recYsnNoOut(JSONObject objectdetail, Timestamp time){
        try {
            YsnNoOutModel ysnNoOutModel = new YsnNoOutModel();
            ysnNoOutModel.setC_id(objectdetail.getInteger("C_ID"));
            YsnNoOutInsert(ysnNoOutModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnBq表
     * @param ysnBqModel
     * */
    public int YsnBqInsert( YsnBqModel ysnBqModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_bq" +
                "(c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnBqModel.getC_values(),
                timec, time, "Y"});
    }

    /**
     * YsnBq
     * */
    public void recYsnBq(JSONObject objectdetail, Timestamp time){
        try {
            YsnBqModel ysnBqModel = new YsnBqModel();
            ysnBqModel.setC_values(objectdetail.getString("C_VALUES"));
            YsnBqInsert(ysnBqModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnO2oBack表
     * @param ysnO2oBackModel
     * */
    public int YsnO2oBackInsert(YsnO2oBackModel ysnO2oBackModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2oback" +
                "(c_id," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oBackModel.getC_id(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oBack
     * */
    public void recYsnO2oBack(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oBackModel ysnO2oBackModel = new YsnO2oBackModel();
            ysnO2oBackModel.setC_id(objectdetail.getInteger("C_ID"));
            YsnO2oBackInsert(ysnO2oBackModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


    /**
     * 插入YsnBq1表
     * @param ysnBq1Model
     * */
    public int YsnBq1Insert(YsnBq1Model ysnBq1Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_bq1" +
                "(c_id,vaules," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnBq1Model.getC_id(),ysnBq1Model.getVaules(),
                timec, time, "Y"});
    }

    /**
     * YsnBq1
     * */
    public void recYsnBq1(JSONObject objectdetail, Timestamp time){
        try {
            YsnBq1Model ysnBq1Model = new YsnBq1Model();
            ysnBq1Model.setC_id(objectdetail.getInteger("C_ID"));
            ysnBq1Model.setVaules(objectdetail.getString("VAULES"));
            YsnBq1Insert(ysnBq1Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnO2oSoBack1表
     * @param ysnO2oSoBack1Model
     * */
    public int YsnO2oSoBack1Insert(YsnO2oSoBack1Model ysnO2oSoBack1Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_o2o_so_back1" +
                "(c_id,c_block," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnO2oSoBack1Model.getC_id(),ysnO2oSoBack1Model.getC_block(),
                timec, time, "Y"});
    }

    /**
     * YsnO2oSoBack1
     * */
    public void recYsnO2oSoBack1(JSONObject objectdetail, Timestamp time){
        try {
            YsnO2oSoBack1Model ysnO2oSoBack1Model = new YsnO2oSoBack1Model();
            ysnO2oSoBack1Model.setC_id(objectdetail.getInteger("C_ID"));
            ysnO2oSoBack1Model.setC_block(objectdetail.getString("C_BLOCK"));
            YsnO2oSoBack1Insert(ysnO2oSoBack1Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnCus1表
     * @param ysnCus1Model
     * */
    public int YsnCus1Insert(YsnCus1Model ysnCus1Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_cus1" +
                "(c_id,c_block," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnCus1Model.getC_id(),ysnCus1Model.getC_block(),
                timec, time, "Y"});
    }

    /**
     * YsnCus1
     * */
    public void recYsnCus1(JSONObject objectdetail, Timestamp time){
        try {
            YsnCus1Model ysnCus1Model = new YsnCus1Model();
            ysnCus1Model.setC_id(objectdetail.getInteger("C_ID"));
            ysnCus1Model.setC_block(objectdetail.getString("C_BLOCK"));
            YsnCus1Insert(ysnCus1Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnNoOut1表
     * @param ysnNoOut1Model
     * */
    public int YsnNoOut1Insert(YsnNoOut1Model ysnNoOut1Model, Timestamp timec) throws Exception {

        String sql = "insert into ysn_noout1" +
                "(c_id,orig," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnNoOut1Model.getC_id(),ysnNoOut1Model.getOrig(),
                timec, time, "Y"});
    }

    /**
     * YsnNoOut1
     * */
    public void recYsnNoOut1(JSONObject objectdetail, Timestamp time){
        try {
            YsnNoOut1Model ysnNoOut1Model = new YsnNoOut1Model();
            ysnNoOut1Model.setC_id(objectdetail.getInteger("C_ID"));
            ysnNoOut1Model.setOrig(objectdetail.getString("ORIG"));
            YsnNoOut1Insert(ysnNoOut1Model, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday1Dfh表
     * @param ysnToday1DfhModel
     * */
    public int YsnToday1DfhInsert(YsnToday1DfhModel ysnToday1DfhModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today1_dfh" +
                "(c_id,c_block_org," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday1DfhModel.getC_id(),ysnToday1DfhModel.getC_block_org(),
                timec, time, "Y"});
    }

    /**
     * YsnToday1Dfh
     * */
    public void recYsnToday1Dfh(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday1DfhModel ysnToday1DfhModel = new YsnToday1DfhModel();
            ysnToday1DfhModel.setC_id(objectdetail.getInteger("C_ID"));
            ysnToday1DfhModel.setC_block_org(objectdetail.getString("C_BLOCK_ORG"));
            YsnToday1DfhInsert(ysnToday1DfhModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnNoOut1表
     * @param ysnToday1DlModel
     * */
    public int YsnToday1DlInsert(YsnToday1DlModel ysnToday1DlModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today1_dl" +
                "(c_id,c_prov_name," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday1DlModel.getC_id(),ysnToday1DlModel.getC_prov_name(),
                timec, time, "Y"});
    }

    /**
     * YsnToday1Dl
     * */
    public void recYsnToday1Dl(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday1DlModel ysnToday1DlModel = new YsnToday1DlModel();
            ysnToday1DlModel.setC_id(objectdetail.getInteger("C_ID"));
            ysnToday1DlModel.setC_prov_name(objectdetail.getString("C_PROV_NAME"));
            YsnToday1DlInsert(ysnToday1DlModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday1Zje表
     * @param ysnToday1ZjeModel
     * */
    public int YsnToday1ZjeInsert(YsnToday1ZjeModel ysnToday1ZjeModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today1_zje" +
                "(s_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday1ZjeModel.getS_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday1Zje
     * */
    public void recYsnToday1Zje(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday1ZjeModel ysnToday1ZjeModel = new YsnToday1ZjeModel();
            ysnToday1ZjeModel.setS_tot_amt_actual(objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("S_TOT_AMT_ACTUAL"));
            YsnToday1ZjeInsert(ysnToday1ZjeModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday2Dl表
     * @param ysnToday2DlModel
     * */
    public int YsnToday2DlInsert(YsnToday2DlModel ysnToday2DlModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today2_dl" +
                "(s_id,ts," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday2DlModel.getS_id(),ysnToday2DlModel.getTs(),
                timec, time, "Y"});
    }

    /**
     * YsnToday2Dl
     * */
    public void recYsnToday2Dl(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday2DlModel ysnToday2DlModel = new YsnToday2DlModel();
            ysnToday2DlModel.setS_id(objectdetail.getInteger("S_ID"));
            ysnToday2DlModel.setTs(objectdetail.getString("TS"));
            YsnToday2DlInsert(ysnToday2DlModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday2Tb表
     * @param ysnToday2TbModel
     * */
    public int YsnToday2TbInsert(YsnToday2TbModel ysnToday2TbModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today2_tb" +
                "(ts,d_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday2TbModel.getTs(),ysnToday2TbModel.getD_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday2Tb
     * */
    public void recYsnToday2Tb(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday2TbModel ysnToday2TbModel = new YsnToday2TbModel();
            ysnToday2TbModel.setTs(objectdetail.getString("TS"));
            ysnToday2TbModel.setD_tot_amt_actual(objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL"));
            YsnToday2TbInsert(ysnToday2TbModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday3Fhl表
     * @param ysnToday3FhlModel
     * */
    public int YsnToday3FhlInsert(YsnToday3FhlModel ysnToday3FhlModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today3_fhl" +
                "(orig,m_qty," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday3FhlModel.getOrig(),ysnToday3FhlModel.getM_qty(),
                timec, time, "Y"});
    }

    /**
     * YsnToday3Fhl
     * */
    public void recYsnToday3Fhl(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday3FhlModel ysnToday3FhlModel = new YsnToday3FhlModel();
            ysnToday3FhlModel.setOrig(objectdetail.getString("ORIG"));
            ysnToday3FhlModel.setM_qty(objectdetail.getInteger("M_QTY") == null? 0 : objectdetail.getInteger("M_QTY"));
            YsnToday3FhlInsert(ysnToday3FhlModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday3Lszb表
     * @param ysnToday3LszbModel
     * */
    public int YsnToday3LszbInsert(YsnToday3LszbModel ysnToday3LszbModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today3_lszb" +
                "(store,m_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday3LszbModel.getStore(),ysnToday3LszbModel.getM_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday3Lszb
     * */
    public void recYsnToday3Lszb(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday3LszbModel ysnToday3LszbModel = new YsnToday3LszbModel();
            ysnToday3LszbModel.setStore(objectdetail.getString("STORE"));
            ysnToday3LszbModel.setM_tot_amt_actual(objectdetail.getBigDecimal("M_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("M_TOT_AMT_ACTUAL"));
            YsnToday3LszbInsert(ysnToday3LszbModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday3Tb表
     * @param ysnToday3TbModel
     * */
    public int YsnToday3TbInsert(YsnToday3TbModel ysnToday3TbModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today3_tb" +
                "(store,m_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday3TbModel.getStore(),ysnToday3TbModel.getM_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday3Tb
     * */
    public void recYsnToday3Tb(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday3TbModel ysnToday3TbModel = new YsnToday3TbModel();
            ysnToday3TbModel.setStore(objectdetail.getString("STORE"));
            ysnToday3TbModel.setM_tot_amt_actual(objectdetail.getBigDecimal("M_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("M_TOT_AMT_ACTUAL"));
            YsnToday3TbInsert(ysnToday3TbModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday3Xl表
     * @param ysnToday3XlModel
     * */
    public int YsnToday3XlInsert(YsnToday3XlModel ysnToday3XlModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today3_xl" +
                "(m_id,store," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday3XlModel.getM_id(),ysnToday3XlModel.getStore(),
                timec, time, "Y"});
    }

    /**
     * YsnToday3Xl
     * */
    public void recYsnToday3Xl(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday3XlModel ysnToday3XlModel = new YsnToday3XlModel();
            ysnToday3XlModel.setM_id(objectdetail.getInteger("M_ID"));
            ysnToday3XlModel.setStore(objectdetail.getString("STORE"));
            YsnToday3XlInsert(ysnToday3XlModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday3Xy表
     * @param ysnToday3XyModel
     * */
    public int YsnToday3XyInsert(YsnToday3XyModel ysnToday3XyModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today3_xy" +
                "(name,m_credit_quota," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday3XyModel.getName(),ysnToday3XyModel.getM_credit_quota(),
                timec, time, "Y"});
    }

    /**
     * YsnToday3Xy
     * */
    public void recYsnToday3Xy(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday3XyModel ysnToday3XyModel = new YsnToday3XyModel();
            ysnToday3XyModel.setName(objectdetail.getString("NAME"));
            ysnToday3XyModel.setM_credit_quota(objectdetail.getString("M_CREDIT_QUOTA"));
            YsnToday3XyInsert(ysnToday3XyModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday5BackItem表
     * @param ysnToday5BackItemModel
     * */
    public int YsnToday5BackItemInsert(YsnToday5BackItemModel ysnToday5BackItemModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today5_backitem" +
                "(c_id,o2o_back_reason," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday5BackItemModel.getC_id(), ysnToday5BackItemModel.getO2o_back_reason(),
                timec, time, "Y"});
    }

    /**
     * YsnToday5BackItem
     * */
    public void recYsnToday5BackItem(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday5BackItemModel ysnToday5BackItemModel = new YsnToday5BackItemModel();
            ysnToday5BackItemModel.setC_id(objectdetail.getInteger("C_ID"));
            ysnToday5BackItemModel.setO2o_back_reason(objectdetail.getString("O2O_BACK_REASON"));
            YsnToday5BackItemInsert(ysnToday5BackItemModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday4Ontb表
     * @param ysnToday4OntbModel
     * */
    public int YsnToday4OntbInsert(YsnToday4OntbModel ysnToday4OntbModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today4_ontb" +
                "(d_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday4OntbModel.getD_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday4Ontb
     * */
    public void recYsnToday4Ontb(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday4OntbModel ysnToday4OntbModel = new YsnToday4OntbModel();
            ysnToday4OntbModel.setD_tot_amt_actual(objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL"));
            YsnToday4OntbInsert(ysnToday4OntbModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnNoOut1表
     * @param ysnToday4OnzbModel
     * */
    public int YsnToday4OnzbInsert(YsnToday4OnzbModel ysnToday4OnzbModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today4_onzb" +
                "(d_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday4OnzbModel.getD_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday4Onzb
     * */
    public void recYsnToday4Onzb(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday4OnzbModel ysnToday4OnzbModel = new YsnToday4OnzbModel();
            ysnToday4OnzbModel.setD_tot_amt_actual(objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL"));
            YsnToday4OnzbInsert(ysnToday4OnzbModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday4Source表
     * @param ysnToday4SourceModel
     * */
    public int YsnToday4SourceInsert(YsnToday4SourceModel ysnToday4SourceModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today4_source" +
                "(source,d_tot_amt_actual," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday4SourceModel.getSource(),ysnToday4SourceModel.getD_tot_amt_actual(),
                timec, time, "Y"});
    }

    /**
     * YsnToday4Source
     * */
    public void recYsnToday4Source(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday4SourceModel ysnToday4SourceModel = new YsnToday4SourceModel();
            ysnToday4SourceModel.setSource(objectdetail.getString("SOURCE"));
            ysnToday4SourceModel.setD_tot_amt_actual(objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL") == null? new BigDecimal(0) : objectdetail.getBigDecimal("D_TOT_AMT_ACTUAL") );
            YsnToday4SourceInsert(ysnToday4SourceModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }

    /**
     * 插入YsnToday5BackZb表
     * @param ysnToday5BackZbModel
     * */
    public int YsnToday5BackZbInsert(YsnToday5BackZbModel ysnToday5BackZbModel, Timestamp timec) throws Exception {

        String sql = "insert into ysn_today5_backzb" +
                "(d_id,o2o_back_reason," +
                "CREATIONDATE,MODIFIEDDATE,ISACTIVE)" +
                "values(?,?," +
                "?,?,?) ";
        Timestamp time = new Timestamp(System.currentTimeMillis());

        return QueryEngine.getInstance().executeUpdate(sql, new Object[]{
                ysnToday5BackZbModel.getD_id(),ysnToday5BackZbModel.getO2o_back_reason(),
                timec, time, "Y"});
    }

    /**
     * YsnToday5BackZb
     * */
    public void recYsnToday5BackZb(JSONObject objectdetail, Timestamp time){
        try {
            YsnToday5BackZbModel ysnToday5BackZbModel = new YsnToday5BackZbModel();
            ysnToday5BackZbModel.setD_id(objectdetail.getInteger("D_ID"));
            ysnToday5BackZbModel.setO2o_back_reason(objectdetail.getString("O2O_BACK_REASON"));
            YsnToday5BackZbInsert(ysnToday5BackZbModel, time);
        }catch (Exception e){
            e.printStackTrace();
        }
    }


}
